﻿using System.Collections;
using System.Collections.Generic;
using TTGameEngine;
using UnityEngine;

public class UIDataBase { }

public class UIBase : MonoBehaviour {

    [ReadOnly]
    public UIConfig m_uiconfig = null;
    [ReadOnly]
    public UIDataBase m_uidatabase = null;
    public UIFormID m_uiformID {
        get { return m_uiconfig.formID; }
    }

    // Use this for initialization
    void Awake() {

    }

    // Update is called once per frame
    void Update() {

    }

    public void SetupUI(UIConfig uiconfig, UIDataBase uidata) {
        m_uiconfig = uiconfig;
        m_uidatabase = uidata;
        init();
    }

    public virtual void init() { }

    public virtual void CloseSelf() {
        if(m_uiconfig.openMode == UIOpenMode.MultiOpened) {
            UIManager.Ins.CloseUI(this);
        } else {
            UIManager.Ins.CloseUI(m_uiformID);
        }
    }
}
